<template>
	<div>
		<el-table border width="100%" :data="rightlist">
			<el-table-column label="#" type="index"></el-table-column>
			<el-table-column label="权限名称" prop="authName"></el-table-column>
			<el-table-column label="路径" prop="path"></el-table-column>
			<el-table-column label="权限等级" prop="level">
				<template slot-scope="scope">
					<el-tag v-if="scope.row.level==0" size='small'>一级</el-tag>
					<el-tag type='success' v-else-if="scope.row.level==1" size='small'>二级</el-tag>
					<el-tag type='warning' v-if='scope.row.level==2' size='small'>三级</el-tag>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
	export default {
		// 组件名称
		name: 'demo',
		data() {
			return {
				// 权限列表
				rightlist: [],
			}
		},
		// 组件方法
		methods: {
			// 获取权限列表
			async getRightlist() {
				try {
					const data = await this.$apis.getRights();
					this.rightlist = data.data1;
				} catch (e) {
					console.log(e)
				}
			},
		},
		created() {
			this.getRightlist()
		}
	}
</script>

<style scoped>

</style>
